package edu.cqie.demo02;

/**
 * Proxy
 *
 * @Author XiaoZhou
 * @Date 2023/10/17 19:05
 */
public class Proxy implements UserService {
    private UserServiceImpl userService;

    public Proxy() {

    }

    public void setUserService(UserServiceImpl userService) {
        this.userService = userService;
    }

    @Override
    public void add() {
        log("add");
        userService.add();
    }

    @Override
    public void delete() {
        log("delete");
        userService.delete();
    }

    @Override
    public void update() {
        log("update");
        userService.update();
    }

    @Override
    public void query() {
        log("query");
        userService.query();
    }

    //日志方法
    public void log(String message) {
        System.out.println("使用了一个" + message + "方法");
    }

}
